import {
  SysCustomWidgetType,
  OnlineFormEventType,
  SysOnlineFormType,
} from '@/common/staticDict/index';

const signature = {
  span: {
    name: '组件宽度',
    widgetType: SysCustomWidgetType.Slider,
    value: 12,
    min: 1,
    max: 24,
  },
  height: {
    name: '高度',
    widgetType: SysCustomWidgetType.Input,
    value: '200px',
  },
  backgroundColor: {
    name: '背景颜色',
    widgetType: SysCustomWidgetType.ColorPicker,
    value: '#ffffff',
  },
  penColor: {
    name: '画笔颜色',
    widgetType: SysCustomWidgetType.ColorPicker,
    value: '#333333',
  },
  required: {
    name: '是否必填',
    value: false,
    widgetType: SysCustomWidgetType.Switch,
    dropdownList: [
      {
        id: true,
        name: '必填',
      },
      {
        id: false,
        name: '非必填',
      },
    ],
  },
  disabled: {
    name: '是否禁用',
    value: false,
    visible: function (formConfig) {
      return formConfig && formConfig.form.formType !== SysOnlineFormType.QUERY;
    },
    widgetType: SysCustomWidgetType.Switch,
    dropdownList: [
      {
        id: false,
        name: '启用',
      },
      {
        id: true,
        name: '禁用',
      },
    ],
  },
};

const signatureConfig = {
  widgetType: SysCustomWidgetType.Signature,
  icon: 'online-icon icon-signature',
  attribute: signature,
  allowEventList: [OnlineFormEventType.DISABLE, OnlineFormEventType.VISIBLE],
  supportBindTable: true,
  supportBindColumn: true,
};

export default signatureConfig;
